<template>
	<div class="box">
		<HomeCarousel v-if="bannerAnimation === 0" :swipimgage="swipimgage" :swipimgagewidth="screenWidth" :swipimgageheight="screenHeight"></HomeCarousel>
		<HomeCarouselnew v-if="bannerAnimation === 1" :swipimgage="swipimgage" :swipimgagewidth="screenWidth" :swipimgageheight="screenHeight"></HomeCarouselnew>
	</div>
</template>

<script>
	import HomeCarousel from "@/real-components/HomeCarousel";
	import HomeCarouselnew from "@/real-components/HomeCarousel2";
	import {getPageNameOrVirtualPageName} from "@/utils/getPageName";
	import { mapGetters } from "vuex";
	import { getPageTree, initDomTree } from "@/utils/getPageTree";
	import axios from "axios";
	export default {
		props: {
			list: {
				type: Array,
				default: () => []
			},
			bannerid: {
				type: String,
				default: "con001"
			},
			// pageName: {
			// 	type: String,
			// 	default: "gwTest"
			// }
		},
		data() {
			return {
				msg: '这是首页',
				page: "home",
				componentName: "HomeCarousel",
				componentName: "HomeCarouselnew",
				swipimgage: [],
				/*showdata:true*/
			}
		},
		computed: {
			...mapGetters([
				"getDomTree"
			]),
			/*...mapGetters("xxy", ["getbannerstyleshow"]),*/
			pageTree() {
				return getPageTree(this, this.page);
			},
			screenWidth() {
				if(window.environment === "production") {
					return window.innerWidth;
				} else {
					return 375;
				}
			},
			screenHeight() {
				if(window.environment === "production") {
					return window.innerWidth * 0.454;
				} else {
					return 170;
				}
			},
			bannerAnimation() {
				if(this.bannerid){
					// console.log()
					return parseInt(this.getCurrentVDO(this.bannerid, this.pageName).config.bannerAnimation);
				}
			},
			pageName() {
				return getPageNameOrVirtualPageName();
			}

		},
		components: {
			HomeCarousel,
			HomeCarouselnew
		},
		methods: {
			queryBanner() {
				/*axios.post(api.local_host + '/resourceLevel/resourceLevelListH5', {
					enterpriseId: api.enterpriseId,
					relPosition: 'HomePageBanner'
				}).then((res) => {
					let data = res.data.data[0]
					this.swiperSlides = data;
					for(var i=0;i<data.length;i++){
						this.swipimgage.push(data[i].image)
					}
				})*/
				this.swipimgage = []
				for(var i = 0; i < this.list.length; i++) {
					if(this.list[i].status == 1) {
						this.swipimgage.push(this.list[i])/*.publicityPicture*/
					}
				}
			},
		},
		watch: {
			list() {
				this.queryBanner()
			},
			currentVOD() {
				
			}
		},
		created() {
		},
		mounted() {
			this.queryBanner()
			// initDomTree(this.getDomTree[this.page]);

		},
		updated() {
			//页面更新完毕
			// initDomTree(this.getDomTree[this.page]);
		}
	}
</script>

<style>

</style>